package cn.edu.nit.sys.service.impl;

import cn.edu.nit.sys.entity.Clazz;
import cn.edu.nit.sys.mapper.ClazzMapper;
import cn.edu.nit.sys.service.ClazzService;
import cn.edu.nit.sys.utils.R;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * @Author xiaobai
 * @Date 2022/11/27 13:14
 * @Version 1.0.0
 */
@Service
public class ClazzServiceImpl extends ServiceImpl<ClazzMapper, Clazz> implements ClazzService {

    @Override
    public R getClazzList(Page<Clazz> page, String siftDept, String siftName) {
        Page<Clazz> clazzList = baseMapper.getClazzList(page, siftDept, siftName);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list", clazzList.getRecords());
        jsonObject.put("total", clazzList.getTotal());
        return R.ok(jsonObject);
    }

}
